package com.kevin.proxy.dynamicProxy;

import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class Test {
    String a = "aaa";
    public static void main(String[] args) {
//        T t = new T();
//        Enhancer enhancer = new Enhancer();
//        enhancer.setSuperclass(t.getClass());
//        enhancer.setCallback(new P());
//        T o = (T)enhancer.cr  eate();
//        o.play();
        System.out.println(new Test().a);
        char[] temp = "Love".toCharArray();
        char[] temp4 = "Love".toCharArray();
        char[] temp1 = {'L','o','v','e'};
        char[] temp2 = {'L','o','v','e'};
        System.out.println(temp==temp1);
        System.out.println(temp4.hashCode());
        System.out.println(temp.hashCode());
        System.out.println(temp1.hashCode());
        System.out.println(temp2.hashCode());
        System.out.println("Love".hashCode());
        System.out.println(new B().a);
    }
    public void run(){

        String b = "aaa";
        System.out.println(this.a==b);

    }
}
class B{
    String a = "a";
}
class A{
    String a = "a";

    @Override
    public boolean equals(Object obj) {
        return super.equals(obj);
    }
}

class P implements MethodInterceptor{

    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        System.out.println("before");
        methodProxy.invokeSuper(o,objects);
        System.out.println("after");
        return null;
    }
}

class T{
    void play(){
        System.out.println("play");
    }
}

